feat(cycle): environments & deployment-protection cycle (#12) - #28
Merged
Merged
Conversation
Reconciles deployment environments — required reviewers, wait timers,
self-review prevention, deployment branch policies — via PUT/DELETE
/repos/{o}/{r}/environments/{env}. New EnvironmentConfig + LiveEnvironment
+ environment diff type. RMW apply seeds the full-replacement PUT from
live (or re-fetches) so undeclared protection is preserved.
Registered, exported, action bundle rebuilt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12.
Adds the environments cycle — reconciles deployment environments and their protection.
What it does
GET /repos/{o}/{r}/environments(list) → mapped fromprotection_rules(wait timer, required reviewers, prevent-self-review) +deployment_branch_policy.PUT /repos/{o}/{r}/environments/{env}(create/update, idempotent).DELETE …/environments/{env}(ownership-gated).New types
EnvironmentConfig(+EnvironmentReviewer,DeploymentBranchPolicy) onRepoConfig.environments.LiveEnvironment+diffEnvironments→ newenvironmentresource type (key<repo>/<env>), added toRESOURCE_TYPE_ORDER.RMW (the issue's emphasis: "preserve undeclared protection rules")
The environment PUT replaces the supplied config, so
applyseeds the body from the live environment (via the change-setbefore, or a re-fetch if absent) and overlays only declared fields. A config that sets onlywaitTimerpreserves required reviewers and the branch policy — covered by a dedicated test, plus a re-fetch-when-before-absent test.Verification
npx tsc --noEmitcleannpm testgreen (358 tests; +15 inenvironments.test.ts)🤖 Generated with Claude Code